perm filename TCPSTS.MAC[IP,SYS] blob
sn#680231 filedate 1982-10-14 generic text, type T, neo UTF8
;CWL:<403-TCP>TCPSTS.MAC.40301 29-Jan-82 15:08:21, Edit by CLYNN
; Updated for TCP release 3
SEARCH INPAR,TCPPAR,PROLOG
TTITLE TCPSTS
SUBTTL TCP Statitics Routines, William W. Plummer, 5FEB77
SWAPCD
COMMENT !
WARNING -- These routines are not currently supported
These routines handle time accounting, timestamping and
histogram making.
* STSINI ... 2 ...... Initialize the statistics cells
* TSTAMP ... 3 ...... Process a packet timestamp
DOHIST ... 3 ...... Do the histogram function
* TIMCAL ... 4 ...... Time a subroutine call
*** N. B. All statitics cells are in the normal NRVAR area
and not in the INTSEC.
!
; STSINI Initialize Statistics
; CALL STSINI
;Ret+1: Always
STSINI::MOVE T1,[STAT0,,STAT0+1] ; First cell to clear
SETZM STAT0 ; Clear the first word
BLT T1,STATZZ
MOVEI T1,OHUSE ; Overhead time accumulator
MOVEM T1,TIMPTR ; Select that as the timer
RET
; TSTAMP Process a packet time stamp
;T1/ (Extended) Histogram pointer
;PKT/ (Extended) Packet
;
; CALL TSTAMP
;Ret+1: Always.
TSTAMP::TEMP <HIST,NOW,TIMSTP>
LOAD TIMSTP,PTS,(PKT) ; Get the timestamp from packet
MOVE NOW,TODCLK
STOR NOW,PTS,(PKT) ; Set the new timestamp
SUB NOW,TIMSTP ; Compute Difference
CALL DOHIST ; Do the histogram
RESTORE
RET
; DOHIST Do the histogram functions
;T1/ (Extended) Histogram pointer
;T2/ Sample
;
; CALL DOHIST
;Ret+1: Always
DOHIST::TEMP <HIST,SAMPLE,BINNUM>
IFN <SAMPLE+1-BINNUM>,<PRINTS ?DOHIST: ACs not properly defined>
SKIPGE BINNUM,SAMPLE ; Good sample?
MOVEI BINNUM,↑D36-NHBINS ; No. Put in Garbare Bin.
JUMPL SAMPLE,DOHIS1 ; Don't accumulate bad samples
OPSTR <ADDM SAMPLE,>,HTOTL,(HIST); Accumulate total
INCR HSMPL,(HIST) ; Count samples
JFFO SAMPLE,.+2 ; Take the LOG
MOVEI BINNUM,↑D36
CAIL BINNUM,↑D36-NHBINS+1 ; Super big ones go in last bin
DOHIS1: SUBI BINNUM,↑D36
MOVNS BINNUM
IHBIN HIST,BINNUM ; Count in that bin
RESTORE
RET
; TIMCAL Time a call to a subroutine
;T1/ (Extended) Address to charge time to
;T2/ (Extended) Function to call
;T3/ Arg1 for function
;T4/ Arg2 for function
;TIMPTR/ (Extended) Pointer to current time accumulator
TIMCAL::PUSH P,TIMPTR ; Save old timer
MOVEM T1,TIMPTR ; Set new timer
PUSH P,T3 ; Save ARG1
PUSH P,T4 ; Save ARG2
PUSH P,T2 ; Save routine
IFNKA < CALL GETFRT> ; Get fork's runtime til now
IFKA < NOSKED
MOVE T1,JOBRTT ; Use since this process activated
ADD T1,FKRT ; Use before that time
OKSKED
>
POP P,T4 ; Get the routine address
POP P,T2 ; Get Arg2
EXCH T1,0(P) ; Save start time and get Arg1
CALL 0(T4) ; Call the function
IFKA < POP P,T4 ; Get start time
NOSKED
SUB T4,FKRT ; Compute negative useage
SUB T4,JOBRTT
OKSKED
>
IFNKA < PUSH P,T1 ; Save result of the function
CALL GETFRT ; Get the runtime now, after the funcal
MOVE T3,T1 ; Put in a safe place for a second
POP P,T1 ; Restore the result
POP P,T4 ; Get starting usage
SUB T4,T3 ; Compute negative usage
>
MOVN T3,T4 ; Positive useage
MOVE T2,TIMPTR ; Get current time accumulator
ADDM T3,0(T2) ; Charge to the current timer cell
POP P,T3 ; Restore previous timer
MOVEM T3,TIMPTR
ADDM T4,(T3) ; Avoid double charges
RET
T